const feeds = require("../../sql/feeds")
const sql = require('../../sql/mysql');
const feedrecords = require("../../sql/feedrecords")
const uuid = require('uuid');
module.exports = (req,res)=>{
  req.fields.id = `feed${uuid.v4().split("-")[4]}`;
    sql.add(feeds,req.fields).then(()=>{
      sql.add(feedrecords,{feedmsg:req.fields})
        res.send({
            code:0,
            msg:"添加成功"
        })
    }).catch(()=>{
      res.send(
        {
          code:1,
          msg:"添加失败"
        }
      )
    }) 
}